#nb perl argument array file name open file die store array
open MANIFEST, @ARGV[0] or die $!;
my @manifest = <MANIFEST>;

#map {print $_; } @manifest;

#nb perl match filter array
my @imports = filter( sub { $_ =~ s/^ectool export /ectool import --file / },
    @manifest );
map { ImportLine($_) } @imports;

my @gclist = filter( sub { $_ =~ /^GCList / }, @manifest );

#nb perl substitute map array
@entries = map { $_ =~ s/^GCList //; $_; } @gclist;
map { print $_; } @entries;

sub filter {
    my ( $cond, @coll ) = @_;
    my @out;
    map { push( @out, $_ ) if $cond->($_) } @coll;
    return @out;
}

sub ImportLine {
    my $importCommand = shift;
    print $importCommand;
}

